package com.i2works.smartluolong.web.controller.common;

import com.i2works.smartluolong.utils.base.FlowItemTypeEnum;
import com.i2works.smartluolong.utils.basecommon.BaseCommonService;
import com.i2works.smartluolong.web.service.company.ICompanyApplyService;
import com.i2works.smartluolong.web.service.company.ICompanyChangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 根据itemType获取服务接口
 *
 * @author Liu Yutao <koal@vip.qq.com>
 * @date 2018/6/1 17:30
 */

@Component
public class ItemServerHolder {

    @Autowired
    private ICompanyApplyService companyApplyService;

    @Autowired
    private ICompanyChangeService companyChangeService;


    /**
     * 获取服务
     */
    public BaseCommonService get(String itemType) {
        //工商注册
        if (itemType.equalsIgnoreCase(FlowItemTypeEnum.COMPANY_APPLY.getKey())) {
            return companyApplyService;
        }
        //工商变更
        if (itemType.equalsIgnoreCase(FlowItemTypeEnum.COMPANY_RECORD.getKey())) {
            return companyChangeService;
        }
        return null;
    }
}
